export default class deepCopy {
  static toRawType (value) {
    return Object.prototype.toString.call(value).slice(8, -1)
  }
  /* 已整合在tools中 */
  static copy(obj){
    let emptyObject = null
    if(this.toRawType(obj) == 'Object'){
      emptyObject = {}
    }else if (this.toRawType(obj) == 'Array'){
      emptyObject = []
    }else{
      return obj
    }
    for(let key in obj){
      if(typeof obj[key] != 'object' || obj[key] == null){
        emptyObject[key] = obj[key]
      }else{
        emptyObject[key] = this.copy(obj[key])
      }
    }
    return emptyObject
  }
}
